fix: ConversationsItem title display [Object Object] and support extr…#898
fix: ConversationsItem title display [Object Object] and support extr…#898afc163 merged 4 commits intoant-design:mainfrom
Conversation
…a html properties
📝 WalkthroughWalkthrough本次更改主要扩展了会话项(ConversationItem)组件的灵活性。现在每个会话对象可自定义 className 和 style,并支持所有 Changes
Sequence Diagram(s)sequenceDiagram
participant Parent as Conversations
participant Item as ConversationsItem
Note right of Parent: 遍历 convInfo 列表
Parent->>Item: 传递 convInfo 的所有属性(含 className/style)
Item->>Item: 根据 label 类型决定是否设置 title
Item->>UI: 渲染 <li>,应用合并后的 className 和 style
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
components/conversations/interface.ts (1)
49-52: 修复文档与类型定义的不一致性注释中提到排除了
onClick和direction,但类型定义中只排除了onClick。建议要么更新类型定义排除direction,要么修正注释内容以保持一致性。/** - * @desc html 原生属性(除 onClick, direction 以外) - * @descEN html native attributes(except onClick, direction) + * @desc html 原生属性(除 onClick 以外) + * @descEN html native attributes(except onClick) */components/conversations/index.zh-CN.md (1)
58-58: 修正文档描述以保持一致性文档描述提到排除
onClick和direction,但实际类型定义中只排除了onClick。建议修正描述以匹配实际的类型定义。-| htmlAttrs | html 原生属性(除 onClick, direction 以外) | Omit<React.HTMLAttributes<HTMLLIElement>, 'onClick'> | - | - | +| htmlAttrs | html 原生属性(除 onClick 以外) | Omit<React.HTMLAttributes<HTMLLIElement>, 'onClick'> | - | - |components/conversations/index.en-US.md (1)
57-57: 优化文案和版本标注
建议将html native attributes(except onClick, direction)修改为HTML 原生属性(不包括 onClick 和 direction),并在Version列中补充新增该属性的版本号以便追溯。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
components/conversations/Item.tsx(1 hunks)components/conversations/index.en-US.md(1 hunks)components/conversations/index.tsx(1 hunks)components/conversations/index.zh-CN.md(1 hunks)components/conversations/interface.ts(1 hunks)
🔇 Additional comments (3)
components/conversations/Item.tsx (1)
78-78: 很好的修复!条件设置
title属性的逻辑正确解决了当info.label是 React 元素或对象时显示 "[Object Object]" 的问题。这是对原始问题的直接且有效的修复。components/conversations/index.tsx (2)
162-162: 良好的属性传递实现正确地将
htmlAttrs展开到ConversationsItem组件,使得每个对话项都能接受自定义的 HTML 属性。
167-172: 完善的属性合并逻辑
className和style的合并逻辑实现得很好,既保留了现有的样式配置,又允许通过htmlAttrs进行单项自定义。属性优先级顺序合理。
Bundle ReportChanges will decrease total bundle size by 540.33kB (-79.57%) ⬇️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: antdx-array-pushAssets Changed:
|
|
看下测试用例。 |
原因是 属性展开后 label,disabled,icon 三个传递到了 li 元素。(同时命中 Conversation 以及 pickAttrs) |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #898 +/- ##
=======================================
Coverage 92.52% 92.53%
=======================================
Files 69 69
Lines 1552 1554 +2
Branches 400 418 +18
=======================================
+ Hits 1436 1438 +2
Misses 116 116 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ant-design#898) Co-authored-by: liuyuan <[email protected]>
* chore(deps): bump dawidd6/action-download-artifact from 9 to 10 (#888) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix: ConversationsItem title display [Object Object] and support extr… (#898) Co-authored-by: liuyuan <[email protected]> --------- Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: yuanliu <[email protected]> Co-authored-by: liuyuan <[email protected]>
ant-design#898) Co-authored-by: liuyuan <[email protected]>
* feat: x-markdown init * feat: init preivew docs * feat: add plugins and demos * feat: typescript * chore(deps): bump dawidd6/action-download-artifact from 9 to 10 (#888) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix: ConversationsItem title display [Object Object] and support extr… (#898) Co-authored-by: liuyuan <[email protected]> * chore: workspace init (#823) * chore: merge next * chore: coverage * fix: snapshot * chore: ci * Potential fix for code scanning alert no. 16: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * chore: size-limit * chore: pkg manager * chore: size-limit * chore: scripts --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * chore: document initialization for adding SDK and markdown (#895) * docs: 2.0 docs tab * docs: 2.0 docs tab * docs: docs of new tab * docs: docs of new tab * fix: mako fail * feat: modify latex and codehighlight types * chore: merge * chore: x-markdown * chore: x-markdown * feat: justify xmarkdown structure * feat: justify xmarkdown structure * feat: fix code review * feat: fix circle dependece * chore: x-markdown * chore: x-markdown * chore: x-markdown * chore: x-markdown * chore: delete index.ts * chore: delete index.ts * feat: finish baisc function and docs * feat: fix ci error * feat: fix ci error * feat: change plugins path * feat: change plugins path * feat: components support render any tags * feat: change dumi path * feat: fix tsc error * feat: change code highlight path * feat: change codehighlight path * feat: modify demo and html renderer * feat: update test cases * feat: optimize useStreaming hooks * feat: thought-chain motions --------- Co-authored-by: jinyang <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: yuanliu <[email protected]> Co-authored-by: liuyuan <[email protected]> Co-authored-by: elrrrrrrr <[email protected]> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* chore(deps): bump dawidd6/action-download-artifact from 9 to 10 (#888) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix: ConversationsItem title display [Object Object] and support extr… (#898) Co-authored-by: liuyuan <[email protected]> --------- Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: yuanliu <[email protected]> Co-authored-by: liuyuan <[email protected]>
* feat: feat_x_markdown (#986) * feat: x-markdown init * feat: init preivew docs * feat: add plugins and demos * feat: typescript * chore(deps): bump dawidd6/action-download-artifact from 9 to 10 (#888) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix: ConversationsItem title display [Object Object] and support extr… (#898) Co-authored-by: liuyuan <[email protected]> * chore: workspace init (#823) * chore: merge next * chore: coverage * fix: snapshot * chore: ci * Potential fix for code scanning alert no. 16: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * chore: size-limit * chore: pkg manager * chore: size-limit * chore: scripts --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * chore: document initialization for adding SDK and markdown (#895) * docs: 2.0 docs tab * docs: 2.0 docs tab * docs: docs of new tab * docs: docs of new tab * fix: mako fail * feat: modify latex and codehighlight types * chore: merge * chore: x-markdown * chore: x-markdown * feat: justify xmarkdown structure * feat: justify xmarkdown structure * feat: fix code review * feat: fix circle dependece * chore: x-markdown * chore: x-markdown * chore: x-markdown * chore: x-markdown * chore: delete index.ts * chore: delete index.ts * feat: finish baisc function and docs * feat: fix ci error * feat: fix ci error * feat: change plugins path * feat: change plugins path * feat: components support render any tags * feat: change dumi path * feat: fix tsc error * feat: change code highlight path * feat: change codehighlight path * feat: modify demo and html renderer * feat: update test cases * feat: optimize useStreaming hooks * feat: thought-chain motions --------- Co-authored-by: jinyang <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: yuanliu <[email protected]> Co-authored-by: liuyuan <[email protected]> Co-authored-by: elrrrrrrr <[email protected]> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * docs: markdown docs init * feat: optimize parser function * feat: optimize parser function * chore: markdown * docs: markdown docs * chore: markdown * chore: version * chore: version of markdown * chore: version * docs: markdowm * docs: markdown * docs: markdown * docs: markdown * docs: markdown * chore: markdown * chore: prepublishOnly init * chore: prepublishOnly init * docs: markdown * docs: markdown * docs: markdown * feat: modify parser html way and docs * chore: markdown * chore: markdown * feat: add themes & support direction & plugin.types & test config * feat: 修改文档和主题色 * chore: docs * chore: change docs * feat: add render animtion & modify docs * fix: lint error * fix: lint error * chore: add plugin-think * chore: add plugin-think * feat: markdwon docs * feat: markdwon docs * feat: markdwon docs * feat: markdown docs * feat: markdown docs * feat: markdown docs * chore: docs * chore: docs * feat: markdown docs * chore: merge next * feat: remove wrapcssvar * feat: fix lint error * feat: fix lint error * feat: fix lint error * lint: fix lint * feat: resolve confict * fix: lint * lint: fix lint * lint: fix lint error * lint: fix lint * lint: fix lint * feat: package size * lint: fix lint error * lint: fix lint error --------- Co-authored-by: Mickey <[email protected]> Co-authored-by: jinyang <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: yuanliu <[email protected]> Co-authored-by: liuyuan <[email protected]> Co-authored-by: elrrrrrrr <[email protected]> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
ant-design#898) Co-authored-by: liuyuan <[email protected]>


…a html properties
中文版模板 / Chinese template
🤔 This is a ...
修复 #897 ,且让其支持其它 html 属性
🔗 Related Issues
💡 Background and Solution
📝 Change Log
Summary by CodeRabbit
新功能
优化